<?php

// 完善客服信息
// PUT kf.complete

namespace app\api\resource\kf;
use think\Db;

class Complete
{
    // 方法
    public $_method = ['PUT'];
    // 前置
    public $_pre    = ['adminLogin'];
    // 描述
    public $_description = '完善客服信息';
    // 参数
    public $_param  = [
        'qq1' => '客服QQ1',
        'qq2' => '客服QQ2',
        'qq3' => '客服QQ3',
    ];
    // 返回
    public $_return = [
        201 => '完善成功',
        500 => '服务器错误',
    ];

    public function run(&$request)
    {
        $params['qq1'] = $request->put('qq1/s','','trim');
        $params['qq2'] = $request->put('qq2/s','','trim');
        $params['qq3'] = $request->put('qq3/s','','trim');

        $num = Db::name('kf')->where('id',1)->update($params);

        return ($num >= 0) ? [ 201,[] ] : 500;
    }
}